<style>
	@import "../../../common/css/adminHome.css";
</style>
<template>
	<view>
		<view class="admin_common_page">
			<view class="top_fix">
				<view class="search_info">
				</view>
			</view>
			<view class="order-content" @touchmove.stop.prevent>
				<uni-table border stripe emptyText="暂无更多数据" type="selection" >
					<!-- 表头行 -->
					<uni-tr>
						<uni-th align="center">商品名称</uni-th>
						<uni-th align="center">商品数量</uni-th>
					</uni-tr>
					<!-- 表格数据行 -->
					<uni-tr v-for="(item, index) in list" >
						<uni-td align="center">{{item.goodsName}}</uni-td>
						<uni-td align="center">{{item.goodsNumber}}</uni-td>
					</uni-tr>
				</uni-table>
				<view class="uni-form-item uni-column" style="background-color: #FFFFFF;margin-top: 20rpx;background-color: #FFFFFF;margin: 5px 5px 15px 5px;padding: 10rpx;box-shadow: 2px 5px 1px #888">
					<textarea class="uni-input" @input="onKeyInput" placeholder="备注:" style="width: 100%;height: 200rpx;"/>
				</view>
				<button type="primary" @click="tijiao" style="margin-top: 20rpx;background-color:#3B70FD;width: 700rpx;">本次配货确认</button>
				<button type="primary" @click="fanhui" style="margin-top: 20rpx;background-color:#3B70FD;width: 700rpx;">返回</button>
				<view class="tabs-swiper-content">
					<u-tabs-swiper ref="uTabs" :list="dataList" :current="current" @change="tabsChange"
						:is-scroll="false" swiperWidth="750" :bgColor="tabColor" :inactiveColor="inactiveColor"
						:activeColor="activeColor">
					</u-tabs-swiper>
				</view>
				<swiper class="swipers" :style="{height: listSwiperHeight}" :current="swiperCurrent"
					@transition="transition" @animationfinish="animationfinish">
					<swiper-item class="swiper-item" v-for="(item, index) in dataList" :key="index">
						<scroll-tab-swiper-item :tabIndex="index" :currentIndex="swiperCurrent" @backOrder="backOrder">
						</scroll-tab-swiper-item>
					</swiper-item>
				</swiper>
			</view>
		</view>
		<tabBarAdmin :pagePath="'/pages/admin/fenjian/fenjian'"></tabBarAdmin>
	</view>
</template>
import cgSwiper from '@/components/cg-swiper/cg-swiper.vue';
import backOrder from '@/components/show-model/show-backOrder/back-order.vue'
import createShop from '@/components/show-model/show-createShop/create-shop.vue'
<script>
	export default {
		data() {
			return {
				inputValue: '',
				activityId: null,
				agentShopId: null,
				list: [], //采购列表
				single: '',
				datetimesingle: '2021-04-3',
				range: ['2021-03-8', '2021-4-20'],
				datetimerange: ['2021-03-20 20:10:10', '2021-05-10 10:10:10'],
			}
		},
		onLoad(e) {
			console.log(e)
			this.agentShopId = e.agentShopId
			this.activityId = e.activityId
			let postData = {
				activityId: e.activityId,
				agentShopId: e.agentShopId
			}
			this.$api.caigou.purchaseSortings(postData)
				.then(res => {
					if (res.code == 200) {
						// this.scsList = res.data
						console.log(res.rows)
						this.list = res.rows
					} else {
						this.$commonJs.showToast.showNoneToast(res.err)
					}
				})
				.catch(err => {
					this.$commonJs.showToast.showNoneToast(err)
				})
		},
		watch: {
			datetimesingle(newval) {
				console.log('单选:', this.datetimesingle);
			},
		},
		mounted() {
			setTimeout(() => {
				let newDate = new Date();
				let years = newDate.getFullYear();
				let Months = newDate.getMonth() + 1;
				let Dates = newDate.getDate();
				console.log(years, Months + 1, Dates)
				this.datetimesingle = years + "-" + Months + "-" + Dates
				this.single = years + "-" + Months + "-" + Dates
			}, 1000)
		},
		methods: {
			onKeyInput: function(event) {
				this.inputValue = event.target.value
			},
			fanhui(){
				uni.navigateBack({
					delta:1
				})
			},
			tijiao() {
				console.log("提交")
				let postData = {
					activityId: this.activityId,
					agentShopId: this.agentShopId,
					remark: this.inputValue
				}
				console.log(106, postData)
				this.$api.caigou.purchaseSorting_apply(postData)
					.then(res => {
						if (res.code == 200) {
							console.log(res.data)
							uni.showModal({
								title: '配货完成',
								showCancel: false,
								// content: '这是一个模态弹窗',
								success: function(res) {
									if (res.confirm) {
										console.log('用户点击确定');
										uni.navigateBack({
											delta: 1
										})
									} else if (res.cancel) {
										console.log('用户点击取消');
									}
								}
							});

						} else {
							this.$commonJs.showToast.showNoneToast(res.err)
						}
					})
					.catch(err => {
						this.$commonJs.showToast.showNoneToast(err)
					})
			},
			change(e) {
				this.single = e
				console.log('----change事件:', this.single = e);
				let postData = {
					endTime: this.single
				}
				console.log(106, postData)
				this.$api.caigou.caigous(postData)
					.then(res => {
						if (res.code == 200) {
							// this.scsList = res.data
							console.log(res.data)
							this.list = res.data

						} else {
							this.$commonJs.showToast.showNoneToast(res.err)
						}
					})
					.catch(err => {
						this.$commonJs.showToast.showNoneToast(err)
					})
			},
			changeLog(e) {
				console.log('----change事件:', e);
			},
			maskClick(e) {
				console.log('----maskClick事件:', e);
			}
		}
	}
</script>

<style lang="scss">
	@import '@/common/uni-nvue.scss';
</style>
